﻿using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.NetworkInformation;
using System.Text;
using System.Threading.Tasks;
using WorkflowCore.Service.Persisted;

namespace WorkflowCore.Service.Dto.Fundamentals
{
    public class GetWorkflowData
    {
        private readonly WorkflowCoreDbcontext dbcontext;

        public GetWorkflowData(WorkflowCoreDbcontext dbcontext_)
        {
            dbcontext = dbcontext_;
        }
        public dynamic GetWorkflowCoreAllData(string WorkflowCoreId,string Formfields)
        {
            //var FormData = JsonConvert.SerializeObject(Formfields);
            //string WorkflowInStandeId = dbcontext.persistedWorkflowInstance.AsQueryable().Where(x => x.WorkflowDefinitionId == WorkflowCoreId && x.FormFields == Formfields)
            var WorkflowInStandeId_ = dbcontext.persistedWorkflowInstance.FirstOrDefault(x => x.WorkflowDefinitionId == WorkflowCoreId && x.FormFields == Formfields);
            string WorkflowInStandeId = WorkflowInStandeId_.WorkflowInstanceId;
            return WorkflowInStandeId;
        }
    }
}
